﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils.Extention;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/7/31 21:01:26
* 文件名：Left.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Web.WebAdmin
{
    public partial class Left : ChinaLeg.Web.Lib.PageBase
    {
        protected bool IsAdmin;
        protected void Page_Load(object sender, EventArgs e)
        {
            IsAdmin = this.IsAdmin();
            if (!this.IsPostBack)
            {
                rptFocus.DataSource = ChinaLeg.Cache.Category.Instance.GetNotParentCatList();
                rptFocus.DataBind();

                rptNews.DataSource = ChinaLeg.Cache.Category.Instance.GetOneLevelList();
                rptNews.DataBind();
            }
            
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="PageType"></param>
        /// <returns></returns>
        protected string GetNewsLink(int PageType)
        {
            string url = "";
            switch (PageType)
            {
                case 2:
                    url = "News/NewsList.aspx";
                    break;
                case 3:
                    url = "CaseShow/CaseShowList.aspx";
                    break;
                case 4:
                    url = "CasePictrue/CasePictrueList.aspx";
                    break;
            }
            return url;
        }


        protected void rptNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            int id = (e.Item.FindControl("litId") as Literal).Text.ToInt32();
            Repeater rpt = e.Item.FindControl("prtChild") as Repeater;
            rpt.DataSource = ChinaLeg.Cache.Category.Instance.GetChildLevelList(id);
            rpt.DataBind();
        }
    }
}